<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
		<center><h:outputLabel value="Umfrage hinzufügen" styleClass="ueberschrift"/></center>
		<table id="addSurvey_table" class="standart kontoverwaltung">
			<tr>
				<td><h:outputText value="Bezeichnung:" /></td>
				<td><h:inputText value="#{SurveyAddViewBean.label}" /></td>
			</tr>
			<tr>
				<td><h:outputText value="Anonyme Umfrage:" /></td>
				<td>
					<h:selectOneRadio value="#{SurveyAddViewBean.anonyme}">
						<f:selectItem itemLabel="nein" itemValue="false"/>
						<f:selectItem itemLabel="ja" itemValue="true"/>
					</h:selectOneRadio>
				</td>
			</tr>
			<tr>
				<td colspan="2"><center>
					<rich:dragIndicator id="ind" acceptClass="accept" rejectClass="reject" draggingClass="default">         
					Zieh den Fragebogen ins rechte Feld   
					</rich:dragIndicator> 
					<h:panelGrid columnClasses="valign" columns="2" width="100%">
					<rich:panel styleClass="panelc">                 
						<f:facet name="header">                     
							<center><h:outputText value="Fragebögen" /></center>                 
						</f:facet>                 
					<h:dataTable id="src" columns="1" 
					value="#{SurveyAddViewBean.allQuestionSheets}" var="qs" 
					footerClass="footerClass">                     
						<h:column>                         
							<a4j:outputPanel layout="block" styleClass="default">
							<rich:dragSource type="fragebogen" dragIndicator="ind" dragValue="#{qs}" />                             
							<h:outputText value="#{qs.bezeichnung}"></h:outputText>                         
							</a4j:outputPanel>                     
						</h:column>                     
						<f:facet name="footer">                         
							<a4j:commandButton action="#{SurveyAddViewBean.reset()}" value="neu wählen"       
								render="src qs_table" />                     
						</f:facet>                 
					</h:dataTable>          
					</rich:panel>       
					        
					<rich:panel styleClass="dropTargetPanel">                 
						<f:facet name="header">                    
					 		<center><h:outputText value="ausgewählter Fragebogen" /></center>                 
					 	</f:facet>                 
					 	<rich:dropTarget acceptedTypes="fragebogen" dropValue="Fragebogen" 
					 	dropListener="#{SurveyAddViewBean.dropListener}" render="qs_table,src" />   
					 	<center>       
					 	<h:dataTable id="qs_table" columns="1" value="#{SurveyAddViewBean.questionSheets}" 
					 	var="qs" style="width:100%;">                     
					 	<h:column>                         
						 <center><h:outputText style="font-size: 14; font-weight: bold;" value="#{qs.bezeichnung}"></h:outputText></center>
						 <rich:dataTable rowClasses="rowstyle2,rowstyle1" value="#{SurveyAddViewBean.questionsFromSelectedSheet}" var="f"
						 style="width:100%;">
						 <rich:column>
						 	<f:facet name="header">Fragetext</f:facet>
						 	<h:outputText value="#{f.text}" />
						 </rich:column>
						 <rich:column>
						 	<f:facet name="header">typ</f:facet>
						 	<h:outputText value="#{f.typ}" />
						 </rich:column>
						 </rich:dataTable>                     
					 </h:column>                 
					 </h:dataTable> 
					 </center>         
					</rich:panel> 
					</h:panelGrid>
				</center></td>
			</tr>
			<tr>
				<td colspan="2"><center><a4j:commandButton action="#{SurveyAddViewBean.createNewSurvey()}"  onbegin="#{rich:component('Loadingpopup')}.show();" execute="mainmenueform" oncomplete="#{rich:component('Loadingpopup')}.hide();" value="speichern" render="mainmenueform,Messagespopup"/></center></td>
			</tr>
		</table>
								
</ui:composition>